package show;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;

import util.JdbcUtil;

@SuppressWarnings("unchecked")
public class Detail_show 
{
	private Connection conn;
	private PreparedStatement ps;
	private ResultSet rs;
	
	private LinkedList NAME;
	private LinkedList ID;
	private LinkedList FOOD;
	private LinkedList PRIMAR;
	private LinkedList MIDDLE;
	private LinkedList HIGH;
	private LinkedList PA;
	private LinkedList MA;
	
	public Detail_show()
	{
		conn = JdbcUtil.getConnection();
		
		NAME = new LinkedList();
		ID = new LinkedList();
		FOOD = new LinkedList();
		PRIMAR = new LinkedList();
		MIDDLE = new LinkedList();
		HIGH = new LinkedList();
		MA = new LinkedList();
		PA = new LinkedList();
		
		String table = "detail_info";
		String sql = "select * from "+table;
		try
		{
			ps = conn.prepareStatement(sql);
			rs = ps.executeQuery();
			while(rs.next())
			{
				ID.add(rs.getInt("SchID"));
				NAME.add(rs.getString("NAME"));
				FOOD.add(rs.getString("FOOD"));
				PRIMAR.add(rs.getString("PRIMAR"));
				MIDDLE.add(rs.getString("MIDDLE"));
				HIGH.add(rs.getString("HIGH"));
				PA.add(rs.getString("PA"));
				MA.add(rs.getString("MA"));
			}
		}
		catch(SQLException e)
		{
			e.printStackTrace();
		}
		finally
		{
			JdbcUtil.release(conn, ps, rs);
		}
	}

	public LinkedList getNAME() {
		return NAME;
	}

	public LinkedList getID() {
		return ID;
	}

	public LinkedList getFOOD() {
		return FOOD;
	}

	public LinkedList getPRIMARY() {
		return PRIMAR;
	}

	public LinkedList getMIDDLE() {
		return MIDDLE;
	}

	public LinkedList getHIGH() {
		return HIGH;
	}

	public LinkedList getPA() {
		return PA;
	}

	public LinkedList getMA() {
		return MA;
	}
	public static void main(String[] args)
	{
		Detail_show d = new Detail_show();
		System.out.println(d.getID().get(1));
		System.out.println(d.getNAME().get(d.getID().indexOf(d.getID().get(1))));
	}
}
